<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBalanceDetailTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('balance_details', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('用户uid');
            $table->integer('flow_id')->default(0)->comment('流水id');
            $table->decimal('money', 8, 2)->default(0)->comment('金额：正数代表增加,负数代表减除');
            $table->decimal('balance', 8, 2)->default(0)->comment('余额');
            $table->tinyInteger('is_valid')->default(1)->comment('有效状态：0无效，1有效');
            $table->string('remark', 200)->default('')->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('balance_details');
    }
}
